DEFINITION FOR C MODULE NonVolatile ;

FROM SYSTEM IMPORT STRING, ADDRESS, LONGSET ;
FROM Exec   IMPORT MinNode, MinListPtr ;

TYPE
  NVInfoPtr  = POINTER TO NVInfo ;
  NVEntryPtr = POINTER TO NVEntry ;

  NVInfo = RECORD
    nvi_MaxStorage  : LONGINT ;
    nvi_FreeStorage : LONGINT ;
  END ;

  NVEntry = RECORD
    nve_Node : MinNode ;
    nve_Name : STRING ;
    nve_Size : LONGINT ;
    nve_Protection : LONGSET ;
  END ;

(* bit definitions for mask in SetNVProtection().  Also used for *)
(* NVEntry.nve_Protection.					 *)

CONST
  NVEB_DELETE	=  0 ;
  NVEB_APPNAME	= 31 ;

  NVEF_DELETE	= {NVEB_DELETE} ;
  NVEF_APPNAME	= {NVEB_APPNAME} ;


CONST
  (* errors from StoreNV() *)
  NVERR_BADNAME		= 1 ;
  NVERR_WRITEPROT	= 2 ;
  NVERR_FAIL		= 3 ;
  NVERR_FATAL		= 4 ;

(*--- functions in V40 or higher (Release 3.1) ---*)

PROCEDURE GetCopyNV( ppName , itemName : STRING ;
		     killRequesters    : BOOLEAN ) : ADDRESS ;

PROCEDURE FreeNVData( data : ADDRESS ) ;

PROCEDURE StoreNV( appName , itemName : STRING ;
		   data	  : ADDRESS ;
		   length : LONGINT ;
		   killRequesters : BOOLEAN ) : CARDINAL ;

PROCEDURE DeleteNV( appName , itemName : STRING ;
		    killRequesters : BOOLEAN ) : BOOLEAN ;

PROCEDURE GetNVInfo( killRequesters : BOOLEAN ) : NVInfoPtr ;

PROCEDURE GetNVList( appName : STRING ; killRequesters : BOOLEAN ) : MinListPtr;

PROCEDURE SetNVProtection( appName , itemName : STRING ;
			   mask : LONGSET ;
			   killRequesters : BOOLEAN ) : BOOLEAN ;

END NonVolatile.
